package StuManagerSystem.service;

import StuManagerSystem.bean.Person;
import StuManagerSystem.bean.Student;

import java.util.List;
import java.util.Scanner;

public class StudentService {
	
	//查看成绩
	public static void checkScore(Student stu) {
		System.out.println("\t\t姓名\t|\t语文\t|\t数学\t|\t英语");
		System.out.println("\t\t" + stu.getUsername() + "\t|\t" + stu.getChinese() + "\t|\t" + stu.getMath()
				+ "\t|\t" + stu.getEnglish());
	}
	
	//查看信息
	public static void checkInfo(Student stu) {
		System.out.println("\t\t学号\t\t|\t姓名\t|\t密码\t|\t性别\t|\t年龄\t|\t专业");
		System.out.println(
				"\t\t" + stu.getNumber() + "\t|\t" + stu.getUsername() + "\t|\t" + stu.getPassword()
						+ "\t|\t" + stu.getSex() + "\t|\t" + stu.getAge() + "\t|\t" + stu.getMajor());
	}

	//修改密码
	public static boolean updatePassword(String id,List<Person> studentList) {
		Scanner sc = new Scanner(System.in);
		System.out.print("\t\t请输入新密码：");
		String newPwd = sc.next();
		for(int i=0; i<studentList.size(); i++) {
			if(id.equals(studentList.get(i).getNumber())) {
				studentList.get(i).setPassword(newPwd);
				return true;
			}
		}
		return false;
	}

	
}
